package users

import (
	"github.com/gin-gonic/gin"
	"tao-admin/utils"
)

func UserViewInit(e *gin.Engine) {
	view := NewUserView()
	//init url
	userURLInit(e, view)
}

func userURLInit(e *gin.Engine, view *UserView) {
	e.GET("/api/users/search", view.searchUserInfoView)
	e.POST("/api/users/register", view.createUserInfoView)
	e.POST("/api/users/update", view.updateUserInfoView)
	//登录认证
	loginGroup := e.Group("/api/users/login")
	{
		loginGroup.POST("/", view.userLoginView)   //登录服务器
		loginGroup.POST("/refresh", utils.Refresh) //生成新token
	}
	//e.POST("/api/users/login", view.userLoginView)
	e.POST("/api/users/logout", view.userLogoutView)
	e.POST("/api/users/info", view.getUserView)
	e.GET("/api/users/get_test", view.getTestView)
	e.POST("/api/users/post_test", view.postTestView)

	e.GET("/api/users/wechat", view.getWechatView)
	e.GET("/api/users/wechat2", view.getQQView)
	//e.GET("/api/users/loginByAuths", view.loginByAuths)
}
